﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.ProjectBZJ
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.ProjectBZJ;

    public class ProjectTBSQ_Map : ClassMapping<ProjectTBSQ>
    {
        public ProjectTBSQ_Map()
        {
            //映射ID
            Id(x => x.Id, map =>
            {
                map.Column("sq_id");
                map.Length(40);
            });

            Property(x => x.IsValid, map =>
            {
                map.Column("is_valid");
            });

            Property(x => x.CreateDate, map =>
            {
                map.Column("create_date");
            });

            Property(x => x.sqDescribe, map =>
            {
                map.Column("sq_describe");
                map.Length(1000000);
            });

            Property(x => x.sqDate, map =>
            {
                map.Column("sq_date");
            });

            Property(x => x.sqFlag, map =>
            {
                map.Column("sq_flag");
            });

            Property(x => x.endFlag, map =>
            {
                map.Column("is_end");
            });

            Property(x => x.endDate, map =>
            {
                map.Column("end_date");
            });

            Property(x => x.ProcessDescribe, map =>
            {
                map.Column("process_describe");
                map.Length(1000000);
            });

            ManyToOne(x => x.sqUser, map =>
            {
                map.Column("op_user_id");
            });

            Bag(x => x.details, map =>
            {
                map.Key(keyMapper => keyMapper.Column("sq_id"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());

            Table("t_tb_sq");
        }
    }
}
